package com.sparrow.common.ai.behaviortree.node.impl;

import com.sparrow.common.ai.behaviortree.node.AbstractBehaviorNode;
import com.sparrow.common.ai.behaviortree.node.BehaviorNode;
import com.sparrow.common.ai.behaviortree.task.BehaviorTask;
import com.sparrow.common.ai.behaviortree.task.impl.ParallelTask;

import java.util.List;

/**
 * 并行执行多个子节点，直到满足某个条件才返回成功或失败。
 */
public class ParallelNode extends AbstractBehaviorNode {

    private List<BehaviorNode> children;

    public ParallelNode(java.util.List<BehaviorNode> children) {
        this.children = children;
    }

    @Override
    public BehaviorTask createTask() {
        return new ParallelTask(this, ParallelTask.FinishStrategy.ALL);
    }

    @Override
    public List<BehaviorNode> getChildren() {
        return children;
    }


}
